﻿using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using CYQ.Data;
using CYQ.Entity.MySpace;


/// <summary>
/// Service 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
    public Service() {    }

    [WebMethod]
    public string GetUsersInfo()
    {
        string json;
        using (MAction action = new MAction(TableNames.Blog_User))
        {
            json = action.Select().ToJson();
        }
        return json;
    }
    [WebMethod]
    public bool UpdateUserInfo(string json)
    {
        bool result = false;
        using (MAction action = new MAction(TableNames.Blog_User))
        {
            action.GetFromJson(json);
            if (action.Get<int>(Users.ID) > 0)
            {
                result = action.Update();
            }
            else
            {
                result = action.Insert();
            }
        }
        return result;
    }
}

